import { defHttp } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';
import { BaseResponse } from '@/api/base';
import { ContentTypeEnum } from '@/enums/httpEnum';

// 定义接口地址
enum Api {
  /** 生成api.ts */
  API_TS = '/toolkit/genVben/apiTs',
  /** 生成 domain类型 */
  DOMAIN = '/toolkit/genVben/domain',

}

// 定义参数类型




export interface GenApiTsRequest {
  canonicalName?: String;
}

// 定义接口方法
// 生成api.ts
export function apiTs(params: GenApiTsRequest, mode: ErrorMessageMode = 'message') {
  return defHttp.post<BaseResponse<boolean>>(
    {
      url: Api.API_TS,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}

// 生成 domain类型
export function domain(params: String, mode: ErrorMessageMode = 'message') {
  return defHttp.post<BaseResponse<boolean>>(
    {
      url: Api.DOMAIN,
      params,
      headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
    },
    {
      errorMessageMode: mode,
    },
  );
}



